home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / CALib & You… / Source / CALib / Implementation / UI / CAUIEvt.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-07  |  2.6 KB  |  125 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CAUIEvt.cpp
  3.  
  4.     Contains:    Container Application Library source - UI events
  5.  
  6.     Written by:    Rick Badertscher
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         <17>     5/21/95    DHN        Check cmd key in DispatchEvent rather than rely on MenuKey()
  13.         <16>     5/19/95    SJF        Add null events back into dispatching for embedded parts
  14.         <10>     5/15/95    RB        Adding CA_CATCH
  15.          <9>     4/23/95    RB        More mods to CADispatchEvent().
  16.          <8>     4/22/95    RB        Mods to CADispatchEvent()
  17.          <7>     4/13/95    RB        Implemented CAGetSleepTime() and CAGetMouseRgn()
  18.          <6>     4/08/95    RB        Fixed ref count problems in CADispatchEvent()
  19.          <5>     3/30/95    RB        Modified CADispatchEvent to preserve the
  20.                                      untouched portion of the updateRgn during
  21.                                      an update event.
  22.                                      
  23.          <4+>     2/28/95    SJF        Add debug stuff to API calls
  24.          <4>     2/13/95    SJF        Interim checkin to update project database
  25.          <3)    12/15/94    SJF        change somGetGlobalEnvironment to _gpProxyShell->GetGlobalEnvironment
  26.          <2>    10/30/94    GCA,DHN    All mods to make project compile with no
  27.                                      errors under OpenDoc b1 (with SOM).
  28.          <1>    10/16/94    SJF        first written
  29.          
  30.     To Do:
  31. */
  32.  
  33. #ifndef _CASESSN_
  34. #include "CASessn.h"
  35. #endif
  36.  
  37. #ifndef _CAERROR_
  38. #include "CAError.h"
  39. #endif
  40.  
  41. #ifndef _CASDISPTCH_
  42. #include "CADisptch.h"
  43. #endif
  44.  
  45. #ifndef SOM_ODSession_xh
  46. #include <ODSessn.xh>
  47. #endif
  48.  
  49. #ifndef _ODUTILS_
  50. #include <ODUtils.h>
  51. #endif
  52.  
  53. #ifndef SOM_ODDispatcher_xh
  54. #include <Disptch.xh>
  55. #endif
  56.  
  57. #ifndef _CADEBUG_
  58. #include "CADebug.h"
  59. #endif
  60.  
  61.  
  62. #pragma segment CALib
  63.  
  64. //-------------------------------------------------------------------------
  65. // UI Events ***
  66. //-------------------------------------------------------------------------
  67.  
  68. pascal    Boolean        CADispatchEvent( EventRecord* event, CAEventInfo* eventInfo )
  69. {
  70.     
  71.     Boolean                result;
  72.  
  73.     CA_TRY
  74.     
  75.         result = gCASession->GetCADispatcher()->DispatchEvent (event, eventInfo);
  76.     
  77.     CA_CATCH_ALL
  78.     CA_ENDTRY
  79.     
  80.     return (result);
  81.     
  82. }
  83.  
  84.  
  85.  
  86.  
  87. //-------------------------------------------------------------------------
  88. pascal    RgnHandle    CAGetMouseRegion( void )
  89. {
  90.  
  91.     Environment*        ev = gCASession->GetEV();
  92.     ODDispatcher*        dispatcher = gCASession->GetODSession()->GetDispatcher(ev);
  93.     RgnHandle            aRgnHandle = kODNULL;
  94.  
  95.     CA_TRY
  96.  
  97.         aRgnHandle = dispatcher->GetMouseRegion (ev);
  98.     
  99.     CA_CATCH_ALL
  100.     CA_ENDTRY
  101.  
  102.     return aRgnHandle;
  103.     
  104. }
  105.  
  106.  
  107. //-------------------------------------------------------------------------
  108. pascal    long        CAGetSleepTime( void )
  109. {
  110.     Environment*        ev            = gCASession->GetEV();
  111.     ODDispatcher*        dispatcher    = gCASession->GetODSession()->GetDispatcher(ev);
  112.     long                result        = 0;
  113.     
  114.     CA_TRY
  115.  
  116.         result = dispatcher->GetSleepTime (ev);
  117.     
  118.     CA_CATCH_ALL
  119.     CA_ENDTRY
  120.  
  121.     return result;
  122. }
  123.  
  124.  
  125.